import { http } from '@/core/http';

import { IPersonalOverView, SystemConfig } from './type';

export const getOssConfig = () => {
  return http.get<SystemConfig.IConfigResponse>({
    url: '/oss/query/self',
    isLoading: false
  });
};
export const updateOssConfig = (data: SystemConfig.IConfigUpdateRequest) => {
  return http.put<SystemConfig.IConfigResponse>({
    url: '/oss/update',
    isLoading: false,
    isShowSuccessText: true,
    data
  });
};
export const addOssConfig = (data: SystemConfig.IConfigAddRequest) => {
  return http.post({
    url: '/oss/upload',
    isLoading: false,
    isShowSuccessText: true,
    data
  });
};

/**
 * 个人总览
 */
export const personalOverView = () => {
  return http.get<IPersonalOverView.Data>({
    url: '/article/overview'
  });
};

/**
 * 更新网站配置
 */
export const websiteConfigPost = (data: {
    Id: number;
    isCode?: number;
    isRegistryCode?: number;
    isRegistry?: number;
    websiteTitle?: string;
    websiteLogo?: string;
    websiteIcp?: string;
    websiteCover?: string;
    websiteColor?: string;
}) => {
  return http.put<IPersonalOverView.Data>({
    url: '/system/update/website',
    data,
    isShowSuccessText: true
  });
};
